#include "fenshu.hpp"
#include "Cal.hpp"
#include <iostream>

class NumAndCal : public fenshu,public Cal{
    public:
        fenshu num;
        Cal cal;
        NumAndCal();
        NumAndCal(fenshu _num);
        NumAndCal(Cal _cal);
        NumAndCal(string str):num(str){}
        NumAndCal(int _fenzi, int _fenmu=1);
        NumAndCal(const char c);
        int is_num(){return (int)(this->cal.cal<0);}
        string to_string();
};
NumAndCal::NumAndCal(void):num(1), cal('?'){}
NumAndCal::NumAndCal(fenshu _num):cal('?'){
    this->num = _num;
}
NumAndCal::NumAndCal(Cal _cal):num(1){
    this->cal = _cal;
}
NumAndCal::NumAndCal(int _fenzi,int _fenmu):num(_fenzi, _fenmu){
    cal.cal = -1;
}
NumAndCal::NumAndCal(const char c):cal(c){}
string NumAndCal::to_string(){
    if(this->cal.cal>=0){
        return cal.to_string();
    }
    else{
        return num.to_string();
    }
}

// int main(){
//     fenshu tefen(3,2);
//     Cal tecall('+');
//     NumAndCal a(tefen);
//     NumAndCal b(tecall);
//     NumAndCal c(4,5);
//     NumAndCal d('-');
//     cout<<a.to_string()<<endl<<b.to_string()<<endl<<c.to_string()<<endl<<d.to_string()<<endl;
//     return 0;
// }